package edu.java.lectures.lec13.hash;

import java.util.HashMap;
import java.util.Map;

public class HashTest {

    public static void main(String[] args) {
	Person pesho = new Person("Pesho", 21);
	Person peshoCopy = pesho;

	System.out.println(pesho == peshoCopy);

	peshoCopy = new Person("Pesho", 21);

	System.out.println(pesho);
	System.out.println(peshoCopy);

	Map<Person, String> person2nameMap = new HashMap<Person, String>();
	person2nameMap.put(pesho, pesho.getName());

	System.out.println(getPersonName(person2nameMap));
    }

    public static String getPersonName(Map<Person, String> person2nameMap) {
	Person peshoCopy = new Person("Pesho", 21);
	return person2nameMap.get(peshoCopy);
    }
}
